package apralms

class ProductIndex {
	String code
	String name
	
	float targetValue = 0f
	float limitValue = 0f
	
	float assignValue = 0f
	float calValue = 0f
	
	boolean known = false

	static constraints = {
		code blank:false, maxSize:10
		name blank:false, maxSize:50
		
		product blank:false
		parameter blank:false
		
		targetValue min:0f, max:100000f
		limitValue min:0f, max:100000f
		
		assignValue min:0f, max:100000f
		calValue nullable:true
	}

	static belongsTo = [product:Product, scheme:Scheme, parameter:Parameter]
	
	String toString(){
		"${product.name} - ${parameter.name} [${parameter.type}] T=${targetValue} L=${limitValue}"
	}
}
